<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of FileUploaderClass
 *
 * @author seth
 */
class FileUploaderClass {
    //put your code here
    var $filetype;
    var $processed;
    var $destination;
    var $sourceFile;
    var $validFile;
    var $tempLoc;
    const IMAGES="jpg,gif,png";
    const AUDIO="mp3,wma";
    const VIDEO="flv,mov";
    
    public function __construct($src,$dest,$filetype,$resize,$newname) {
        $this->sourceFile=$src;
        $this->destination=$dest;
        $this->filetype=$filetype;
        $this->validateFile();
        $this->processed=false;
    }
    
    function validateFile(){
        switch($this->file_src_name_ext) {
                    case 'jpg':
                    case 'jpeg':
                    case 'jpe':
                        $this->file_src_mime = 'image/jpeg';
                        break;
                    case 'gif':
                        $this->file_src_mime = 'image/gif';
                        break;
                    case 'png':
                        $this->file_src_mime = 'image/png';
                        break;
                    case 'bmp':
                        $this->file_src_mime = 'image/bmp';
                        break;
                    case 'flv':
                        $this->file_src_mime = 'video/x-flv';
                        break;
                    case 'js' :
                        $this->file_src_mime = 'application/x-javascript';
                        break;
                    case 'json' :
                        $this->file_src_mime = 'application/json';
                        break;
                    case 'tiff' :
                        $this->file_src_mime = 'image/tiff';
                        break;
                    case 'css' :
                        $this->file_src_mime = 'text/css';
                        break;
                    case 'xml' :
                        $this->file_src_mime = 'application/xml';
                        break;
                    case 'doc' :
                    case 'docx' :
                        $this->file_src_mime = 'application/msword';
                        break;
                    case 'xls' :
                    case 'xlt' :
                    case 'xlm' :
                    case 'xld' :
                    case 'xla' :
                    case 'xlc' :
                    case 'xlw' :
                    case 'xll' :
                        $this->file_src_mime = 'application/vnd.ms-excel';
                        break;
                    case 'ppt' :
                    case 'pps' :
                        $this->file_src_mime = 'application/vnd.ms-powerpoint';
                        break;
                    case 'rtf' :
                        $this->file_src_mime = 'application/rtf';
                        break;
                    case 'pdf' :
                        $this->file_src_mime = 'application/pdf';
                        break;
                    case 'html' :
                    case 'htm' :
                    case 'php' :
                        $this->file_src_mime = 'text/html';
                        break;
                    case 'txt' :
                        $this->file_src_mime = 'text/plain';
                        break;
                    case 'mpeg' :
                    case 'mpg' :
                    case 'mpe' :
                        $this->file_src_mime = 'video/mpeg';
                        break;
                    case 'mp3' :
                        $this->file_src_mime = 'audio/mpeg3';
                        break;
                    case 'wav' :
                        $this->file_src_mime = 'audio/wav';
                        break;
                    case 'aiff' :
                    case 'aif' :
                        $this->file_src_mime = 'audio/aiff';
                        break;
                    case 'avi' :
                        $this->file_src_mime = 'video/msvideo';
                        break;
                    case 'wmv' :
                        $this->file_src_mime = 'video/x-ms-wmv';
                        break;
                    case 'mov' :
                        $this->file_src_mime = 'video/quicktime';
                        break;
                    case 'zip' :
                        $this->file_src_mime = 'application/zip';
                        break;
                    case 'tar' :
                        $this->file_src_mime = 'application/x-tar';
                        break;
                    case 'swf' :
                        $this->file_src_mime = 'application/x-shockwave-flash';
                        break;
                    case 'odt':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.text';
                        break;
                    case 'ott':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.text-template';
                        break;
                    case 'oth':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.text-web';
                        break;
                    case 'odm':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.text-master';
                        break;
                    case 'odg':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.graphics';
                        break;
                    case 'otg':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.graphics-template';
                        break;
                    case 'odp':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.presentation';
                        break;
                    case 'otp':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.presentation-template';
                        break;
                    case 'ods':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.spreadsheet';
                        break;
                    case 'ots':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.spreadsheet-template';
                        break;
                    case 'odc':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.chart';
                        break;
                    case 'odf':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.formula';
                        break;
                    case 'odb':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.database';
                        break;
                    case 'odi':
                        $this->file_src_mime = 'application/vnd.oasis.opendocument.image';
                        break;
                    case 'oxt':
                        $this->file_src_mime = 'application/vnd.openofficeorg.extension';
                        break;
                    case 'docx':
                        $this->file_src_mime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
                        break;
                    case 'docm':
                        $this->file_src_mime = 'application/vnd.ms-word.document.macroEnabled.12';
                        break;
                    case 'dotx':
                        $this->file_src_mime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template';
                        break;
                    case 'dotm':
                        $this->file_src_mime = 'application/vnd.ms-word.template.macroEnabled.12';
                        break;
                    case 'xlsx':
                        $this->file_src_mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
                        break;
                    case 'xlsm':
                        $this->file_src_mime = 'application/vnd.ms-excel.sheet.macroEnabled.12';
                        break;
                    case 'xltx':
                        $this->file_src_mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template';
                        break;
                    case 'xltm':
                        $this->file_src_mime = 'application/vnd.ms-excel.template.macroEnabled.12';
                        break;
                    case 'xlsb':
                        $this->file_src_mime = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12';
                        break;
                    case 'xlam':
                        $this->file_src_mime = 'application/vnd.ms-excel.addin.macroEnabled.12';
                        break;
                    case 'pptx':
                        $this->file_src_mime = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
                        break;
                    case 'pptm':
                        $this->file_src_mime = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12';
                        break;
                    case 'ppsx':
                        $this->file_src_mime = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow';
                        break;
                    case 'ppsm':
                        $this->file_src_mime = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12';
                        break;
                    case 'potx':
                        $this->file_src_mime = 'application/vnd.openxmlformats-officedocument.presentationml.template';
                        break;
                    case 'potm':
                        $this->file_src_mime = 'application/vnd.ms-powerpoint.template.macroEnabled.12';
                        break;
                    case 'ppam':
                        $this->file_src_mime = 'application/vnd.ms-powerpoint.addin.macroEnabled.12';
                        break;
                    case 'sldx':
                        $this->file_src_mime = 'application/vnd.openxmlformats-officedocument.presentationml.slide';
                        break;
                    case 'sldm':
                        $this->file_src_mime = 'application/vnd.ms-powerpoint.slide.macroEnabled.12';
                        break;
                    case 'thmx':
                        $this->file_src_mime = 'application/vnd.ms-officetheme';
                        break;
                    case 'onetoc':
                    case 'onetoc2':
                    case 'onetmp':
                    case 'onepkg':
                        $this->file_src_mime = 'application/onenote';
                        break;
                }
    }
    function resizeImage()
    {
        $thumb =  new ThumbnailImage($src["temp"],$this->destination,640);
    }
    function  upload(){
    }
   
}
?>
